import React from 'react'
import { BrowserRouter, Route, Switch } from 'react-router-dom'
import { Redirect } from 'react-router-dom/cjs/react-router-dom'
import Login from '../view/login/Login'
import NewSandBox from '../view/Layout/NewSandBox'
import NoPromession from '../view/Layout/noPromession/NoPromession'
import Test from '../view/Test'

export default function indexRouter() {
	return (
		<BrowserRouter>
			<Switch>
				<Route path="/login" component={Login}></Route>
				{/* <Route path="/" component={NewSandBox}></Route> */}
				<Route path="/" render={() => {
					return localStorage.getItem('token') ?
						<NewSandBox></NewSandBox> :
						<Redirect to="/login"></Redirect>
				}
				}></Route>
			</Switch>
		</BrowserRouter>
	)
}
